#!/bin/sh

#
# This script creates and run the pf4j-spring demo.
#

# create artifacts using maven
mvn clean package -DskipTests

# create demo-dist folder
rm -fr dist
mkdir -p dist/plugins

# copy artifacts to dist folder
cp app/target/rran-pf4j-app-*.zip dist/
cp plugins/pluginA/target/rran-pf4j-pluginA-*.zip dist/plugins/
cp plugins/pluginB/target/rran-pf4j-pluginB-*.zip dist/plugins/
cp plugins/enabled.txt dist/plugins/
cp plugins/disabled.txt dist/plugins/

cd dist

# unzip app
jar xf rran-pf4j-app-*.zip
rm rran-pf4j-app-*.zip

# run demo
mv rran-pf4j-app-*-SNAPSHOT.jar pf4j-rran-demo.jar
java -jar pf4j-rran-demo.jar

cd -
